package com.example.warehouse.contrallor;


import com.example.warehouse.entity.Result;
import com.example.warehouse.entity.Store;
import com.example.warehouse.page.Page1;
import com.example.warehouse.service.StoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/store")
public class contrallorStore {

    @Autowired
    private StoreService storeService;
    @RequestMapping("/store-page-list")
    public Result StorePageList(Store store, Page1 page1){
        page1=storeService.QueryPage(store,page1);
        return Result.ok(page1);
    }

    @GetMapping("/store-num-check")
    public Result addStore(){

        return Result.ok();
    }

    @DeleteMapping("/store-delete/{storeId}")
    public Result DeleteStore(@PathVariable Integer storeId){
        storeService.deleteStore(storeId) ;
        return Result.ok("仓库删除成功");
    }

    @PutMapping("/store-update")
    public Result updateStore(@RequestBody Store store){
        storeService.updateStore(store);
        return Result.ok("仓库更新成功");
    }
}
